import React, { Component } from 'react';
import {  withRouter } from 'react-router-dom';
// import {user_subcate} from '../utils/api'
class ClassifyListRight extends Component {
    constructor(props) {
        super(props);
        this.state = {
            id: []
        }
    }

    toGoods(id) {
        //跳转到所有商品页
        this.props.history.push({
            pathname: `/index/goods`,
            search: `id=${id}`
        });
    }
    render() {

        return (
            <div className='right'>
                {
                    this.props.subcatelist.length > 0 && this.props.subcatelist.map((item, index) => {
                        return (
                            <div key={index} className='right_1'>
                                <h5>{item.name}</h5>
                                <div className='rightlist'>
                                    {
                                        item.subNavs.map((a, b) => {
                                            return (

                                                <div className='rightlist_1' key={b}
                                                    onClick={() => { this.toGoods(a.id) }}
                                                >
                                                    
                                                    <img src={a.pic} alt="" />
                                                    <div>{a.name}</div>
                                                    
                                                </div>


                                            )
                                        })
                                    }
                                </div>
                            </div>
                        )
                    })
                }

            </div>
        );
    }
}

export default withRouter(ClassifyListRight);